package com.mac.mapper;

import com.mac.pojo.NewsAndEvents;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;
@SuppressWarnings({"all"})
public interface NewsAndEventsMapper {
    /**
     * 返回所有的新闻
     *
     * @return 返回新闻集合
     */
    @Select("select * from newsandevents")
    @ResultMap("newsandeventsMap")
    ArrayList<NewsAndEvents> selectAllNewsAndEvents();

    /**
     * 根据研究成果id返回对应的新闻
     *
     * @param eventId 新闻id
     * @return 返回 NewsAndEvents 对象
     */
    @Select("select * from newsandevents where event_id = #{eventId}")
    @ResultMap("newsandeventsMap")
    NewsAndEvents selectOneByeventId(@Param("eventId") int eventId);

}


